package main

import "fmt"

type sliceObject struct {
	sInt []int
	sString []string
}

func (so *sliceObject)addSlice( sInt []int, sString []string )  {

	for i := range sInt {
		so.sInt = append(so.sInt, sInt[i])
	}

	so.sString = append(sString)
}

func (so *sliceObject)copySlice(so1 *sliceObject) {
	fmt.Println(so.sInt, so1.sInt)
	copy(so.sInt, so1.sInt)//此处有疑问，待定
	fmt.Println(so.sInt, so1.sInt)

	copy(so.sString, so1.sString)
}

func main()  {
	var s []int
	var a []int = []int{ 1, 2, 3 }

	s = a[:]
	fmt.Println(s)

	var s1 []int = make([]int, 0)
	s1 = a[1:]
	fmt.Println(s1)

	var so *sliceObject = &sliceObject{}

	fmt.Println(*so)

	str := []string{"hello", "world", "go"}
	so.addSlice( a[:], str[:])

	fmt.Println(*so)

	var so1 *sliceObject = &sliceObject{}
	so1.copySlice(so)
	fmt.Println(so1, len(so1.sInt), cap(so1.sString))
}
